package es.udc.emarketapp.emarket.model.purchase.purchaseFacade.actions;

import es.udc.emarketapp.emarket.model.orderDetails.dao.SQLOrderDetailsDAO;
import es.udc.emarketapp.emarket.model.orderDetails.dao.SQLOrderDetailsDAOFactory;
import es.udc.emarketapp.emarket.model.orderDetails.vo.OrderDetailsVO;
import java.sql.Connection;

import es.udc.fbellas.j2ee.util.exceptions.InternalErrorException;
import es.udc.fbellas.j2ee.util.exceptions.ModelException;
import es.udc.fbellas.j2ee.util.sql.TransactionalPlainAction;

public class CreateOrderAction implements TransactionalPlainAction {

    private OrderDetailsVO orderVO;

    public CreateOrderAction(OrderDetailsVO orderVO) {
        this.orderVO = orderVO;
    }

    public Object execute(Connection connection)
            throws InternalErrorException, ModelException {

        SQLOrderDetailsDAO orderDAO = SQLOrderDetailsDAOFactory.getDAO();
        
            return orderDAO.create(connection, orderVO);

    }
}
